import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.data.annotation.Transient;

/**
 * @desc: TODO
 * @author: zhangjiaqi
 * @time: 2020/11/25 11:55
 */
public class School implements ReSerializeModel{
    @Transient
    @JSONField(serialize = false, deserialize = false)
    RString p1 = new RString("打卡的框架阿里1");
    RString p2 = new RString("打卡的框架阿里2");
    RString p3 = new RString("打卡的框架阿里3");
    RString p4 = new RString("打卡的框架阿里4");
    @Transient
    @JSONField(serialize = false, deserialize = false)
    RString p5 = new RString("打卡的框架阿里5");

    RInteger p6 = new RInteger(1);
    RInteger p7 = new RInteger(2);
    @Transient
    @JSONField(serialize = false, deserialize = false)
    RInteger p8 = new RInteger(3);
    RInteger p9 = new RInteger(4);
    @Transient
    @JSONField(serialize = false, deserialize = false)
    RInteger p10 = new RInteger(5);


    RList<Article> list1 = new RList<>();
    RList<Book> list2 = new RList<>();
    RList<Student> list3 = new RList<>();
    RList<Teacher> list4 = new RList<>();

    RMap<Article> map1 = new RMap<>();
    RMap<Book> map2 = new RMap<>();
    RMap<Student> map3 = new RMap<>();
    RMap<Teacher> map4 = new RMap<>();

    public School(){
        list1.getList().add(new Article());
        list1.getList().add(new Article());
        list1.getList().add(new Article());
        list1.getList().add(new Article());
        list1.getList().add(new Article());
        list1.getList().add(new Article());
        list1.getList().add(new Article());

        list2.getList().add(new Book());
        list2.getList().add(new Book());
        list2.getList().add(new Book());
        list2.getList().add(new Book());
        list2.getList().add(new Book());
        list2.getList().add(new Book());

        list3.getList().add(new Student());
        list3.getList().add(new Student());
        list3.getList().add(new Student());
        list3.getList().add(new Student());
        list3.getList().add(new Student());
        list3.getList().add(new Student());
        list3.getList().add(new Student());

        list4.getList().add(new Teacher());
        list4.getList().add(new Teacher());
        list4.getList().add(new Teacher());
        list4.getList().add(new Teacher());
        list4.getList().add(new Teacher());
        list4.getList().add(new Teacher());
        list4.getList().add(new Teacher());

        map1.getMap().put("1", new Article());
        map1.getMap().put("2", new Article());
        map1.getMap().put("3", new Article());
        map1.getMap().put("4", new Article());
        map1.getMap().put("5", new Article());
        map1.getMap().put("6", new Article());
        map1.getMap().put("7", new Article());

        map2.getMap().put("1", new Book());
        map2.getMap().put("2", new Book());
        map2.getMap().put("3", new Book());
        map2.getMap().put("4", new Book());
        map2.getMap().put("5", new Book());
        map2.getMap().put("6", new Book());
        map2.getMap().put("7", new Book());

        map3.getMap().put("1", new Student());
        map3.getMap().put("2", new Student());
        map3.getMap().put("3", new Student());
        map3.getMap().put("4", new Student());
        map3.getMap().put("5", new Student());
        map3.getMap().put("6", new Student());
        map3.getMap().put("7", new Student());

        map4.getMap().put("1", new Teacher());
        map4.getMap().put("2", new Teacher());
        map4.getMap().put("3", new Teacher());
        map4.getMap().put("4", new Teacher());
        map4.getMap().put("5", new Teacher());
        map4.getMap().put("6", new Teacher());
        map4.getMap().put("7", new Teacher());
    }

    public RString getP1() {
        return p1;
    }

    public void setP1(RString p1) {
        this.p1 = p1;
    }

    public RString getP2() {
        return p2;
    }

    public void setP2(RString p2) {
        this.p2 = p2;
    }

    public RString getP3() {
        return p3;
    }

    public void setP3(RString p3) {
        this.p3 = p3;
    }

    public RString getP4() {
        return p4;
    }

    public void setP4(RString p4) {
        this.p4 = p4;
    }

    public RString getP5() {
        return p5;
    }

    public void setP5(RString p5) {
        this.p5 = p5;
    }

    public RInteger getP6() {
        return p6;
    }

    public void setP6(RInteger p6) {
        this.p6 = p6;
    }

    public RInteger getP7() {
        return p7;
    }

    public void setP7(RInteger p7) {
        this.p7 = p7;
    }

    public RInteger getP8() {
        return p8;
    }

    public void setP8(RInteger p8) {
        this.p8 = p8;
    }

    public RInteger getP9() {
        return p9;
    }

    public void setP9(RInteger p9) {
        this.p9 = p9;
    }

    public RInteger getP10() {
        return p10;
    }

    public void setP10(RInteger p10) {
        this.p10 = p10;
    }

    public RList<Article> getList1() {
        return list1;
    }

    public void setList1(RList<Article> list1) {
        this.list1 = list1;
    }

    public RList<Book> getList2() {
        return list2;
    }

    public void setList2(RList<Book> list2) {
        this.list2 = list2;
    }

    public RList<Student> getList3() {
        return list3;
    }

    public void setList3(RList<Student> list3) {
        this.list3 = list3;
    }

    public RList<Teacher> getList4() {
        return list4;
    }

    public void setList4(RList<Teacher> list4) {
        this.list4 = list4;
    }

    public RMap<Article> getMap1() {
        return map1;
    }

    public void setMap1(RMap<Article> map1) {
        this.map1 = map1;
    }

    public RMap<Book> getMap2() {
        return map2;
    }

    public void setMap2(RMap<Book> map2) {
        this.map2 = map2;
    }

    public RMap<Student> getMap3() {
        return map3;
    }

    public void setMap3(RMap<Student> map3) {
        this.map3 = map3;
    }

    public RMap<Teacher> getMap4() {
        return map4;
    }

    public void setMap4(RMap<Teacher> map4) {
        this.map4 = map4;
    }

    @Override
    public Object reSerialize() {
        return this;
    }

    @Override
    public Object toJson() {
        JSONObject json = new JSONObject();
        json.put("p2", SerializaUtils.toJSON(p2));
        json.put("p3", SerializaUtils.toJSON(p3));
        json.put("p4", SerializaUtils.toJSON(p4));
        json.put("p6", SerializaUtils.toJSON(p6));
        json.put("p7", SerializaUtils.toJSON(p7));
        json.put("p8", SerializaUtils.toJSON(p8));

        json.put("list1", SerializaUtils.toJSON(list1));
        json.put("list2", SerializaUtils.toJSON(list2));
        json.put("list3", SerializaUtils.toJSON(list3));
        json.put("list4", SerializaUtils.toJSON(list4));
        json.put("map1", SerializaUtils.toJSON(map1));
        json.put("map2", SerializaUtils.toJSON(map2));
        json.put("map3", SerializaUtils.toJSON(map3));
        json.put("map4", SerializaUtils.toJSON(map4));
        return json;
    }
}
